//
//  SINAAskLeaveItemTableViewCell.m
//  sinashebao
//
//  Created by  androidlongs on 2017/12/25.
//  Copyright © 2017年  androidlongs. All rights reserved.
//

#import "SINAAskLeaveItemTableViewCell.h"
#import "SINACalendarUtils.h"

@interface SINAAskLeaveItemTableViewCell()

@property (weak, nonatomic) IBOutlet UIView *askLeaveView;

@end

@implementation SINAAskLeaveItemTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
   
    [self setBackgroundColor:[UIColor colorWithHexString:@"#eeeeee"]];
   
    [self.askLeaveView setBackgroundColor:[UIColor colorWithHexString:@"#ffffff"]];
    //设置lable的圆角显示
    self.askLeaveView.layer.cornerRadius =1;
    //设置lable的边框 宽度为1
    self.askLeaveView.layer.borderWidth=0;
    //设置lable的边框颜色
    self.askLeaveView.layer.borderColor=[UIColor redColor].CGColor;
    //设置 显示大小范围为 border内容范围中
    self.askLeaveView.clipsToBounds = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    
}

-(void)setModel:(SINAAskLeaveRecordModel *)model{
    _model = model;
    
    if (self.itemClick) {
        [[SINAUiviewClickLiserner alloc]viewClickFunction:self.askLeaveView andWithBlick:^(UIView *view) {
            self.itemClick(self.model);
        }];
    }
    
    //请假状态
    NSString *askStatue = model.askStatue;
    if([askStatue isEqualToString:@"1004"]){
        //通过
        self.askStatueImageView.image=[UIImage imageNamed:@"ask_pass"];
    }else if([askStatue isEqualToString:@"1003"]){
        //审核中
        self.askStatueImageView.image=[UIImage imageNamed:@"ask_ing"];
    }else{
        //驳回
        self.askStatueImageView.image=[UIImage imageNamed:@"ask_no"];
    }
    
    
    //请假类型
    NSString *askType = model.askType;
    self.askTypeLabel.text=[NSString stringWithFormat:@"请假类型：%@",askType];
    
  
    self.askStartTimeLabel.text = [NSString stringWithFormat:@"开始时间：%@",[SINACalendarUtils getDateStringWithTimeStr:model.askStartTime andFormat:@"yyyy-MM-dd HH:mm"]];
    self.askEndTimeLabel.text = [NSString stringWithFormat:@"结束时间：%@",[SINACalendarUtils getDateStringWithTimeStr:model.askEndTime andFormat:@"yyyy-MM-dd HH:mm"]];
    
}

@end
